# coding: UTF-8
# Filename : xml_tpl.py
# Company : imedia
# Author : hui
# -*-coding:utf-8 -*-

#xml头文件
xml_head = '''<?xml version="1.0" encoding="UTF-8" ?>'''
imedia_start = '''<imedia>'''
imedia_end = '''</imedia>'''

#商品模板
product_node = '''
<product>
<id>{id}</id>
<name>{name}</name>
<category>{category}</category>
<image>{image}</image>
<storeinapp>{storeinapp}</storeinapp>
<description><![CDATA[{description}]]></description>
</product>
'''

#比对模板
compare_node = '''
<row>
<id>{id}</id>
<type>{type}</type>
<last_update>{last_update}</last_update>
</row>
'''

#分店模板
part_node = '''
<part>
<id>{id}</id>
<name>{name}</name>
<address>{address}</address>
<tel>{tel}</tel>
<longitude>{longitude}</longitude>
<latitude>{latitude}</latitude>
<storeinapp>{storeinapp}</storeinapp>
<description><![CDATA[{description}]]></description>
</part>
'''

#活动模板
activity_node = '''
<activity>
<id>{id}</id>
<name>{name}</name>
<category_id>{category_id}</category_id>
<category_name>{category_name}</category_name>
<from>{from}</from>
<to>{to}</to>
<image>{image}</image>
<storeinapp>{storeinapp}</storeinapp>
<description><![CDATA[{description}]]></description>
</activity>
'''

#错误模板
error_tpl = '''
<imedia>
<error>
<code>{code}</code>
<msg>{msg}</msg>
</error>
</imedia>
'''

#验证错误
validate_error = error_tpl.replace('{code}', '000').replace('{msg}', '通信验证失败')
pid_not_number = error_tpl.replace('{code}', '301').replace('{msg}', '商品标识不是有效的数字')
